tests: fix static link order#478
Conversation
Place the driver target before CASS_LIBS in target_link_libraries for integration tests. With static linking the linker resolves symbols left-to-right, so the archive providing symbols must precede the libraries that define them. ```sh cmake\ -DCASS_BUILD_INTEGRATION_TESTS=ON \ -DCASS_USE_STATIC_LIBS=ON \ -B build \ && (cd build && make) ``` now works. Before, it would fails with undefined references to OpenSSL symbols. Fixes: scylladb#164 Co-authored-by: Dmitry Kropachev <dmitry.kropachev@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes static-link integration test build failures by correcting the library link order for cassandra-integration-tests so that the driver archive appears before its transitive dependencies (notably OpenSSL), matching how other executables in the repo are linked.
Changes:
- Reorder
target_link_libraries()entries so${PROJECT_LIB_NAME_TARGET}precedes${CASS_LIBS}for the integration test executable.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What's done
Place the driver target before
CASS_LIBSintarget_link_librariesfor integration tests. With static linking the linker resolves symbols left-to-right, so the archive providing symbols must precede the libraries that define them.It's fascinating that the bug comes from the DataStax CPP Driver's build system. They must have never tested static linkage with integration tests.
Verification
now works. Before, it would fails with undefined references to OpenSSL symbols.
Further work
#438 apart of containing this fix, introduced a lot of changes and static linkage verification using the smoke test app. I'm working on making the changes more granular, better documented, and hence mergable.
Fixes: #164
Pre-review checklist
[ ] I have implemented Rust unit tests for the features/changes introduced.[ ] I have enabled appropriate tests inMakefilein{SCYLLA,CASSANDRA}_(NO_VALGRIND_)TEST_FILTER.Fixes:annotations to PR description.